package com.example.child_protection.enums;

import java.util.HashMap;
import java.util.Map;

public enum ResponseCodeEnums {

    SUCCESSFULLY("SUCCESSFULLY", "成功"),

    FAILED("FAILED", "失败"),

    UNKNOWN_EXCEPTION("UNKNOWN_EXCEPTION", "未知异常"),

    LOGIN_INVALID("LOGIN_INVALID", "登录失效"),

    BEFORE_HANDLE_EXCEPTION("BEFORE_HANDLE_EXCEPTION", "前置方法处理异常"),

    ILLEGAL_ARGUMENT_EXCEPTION("ILLEGAL_ARGUMENT_EXCEPTION", "不合法或不正确的参数"),

    VALIDATION_PARAM_EXCEPTION("VALIDATION_PARAM_EXCEPTION", "参数校验异常"),

    NOT_MEET_CONDITIONS_DATA("NOT_MEET_CONDITIONS_DATA", "没有查询到满足条件的数据"),

    BIZ_EXCEPTION("BIZ_EXCEPTION", "业务异常"),

    RESTEASY_EXCEPTION("RESTEASY_EXCEPTION", "RESTEASY异常"),

    DATABASE_EXCEPTION("DATABASE_EXCEPTION", "数据库异常"),

    IDEMPOTENCE_EXCEPTION("IDEMPOTENCE_EXCEPTION", "幂等性校验不通过"),

    DATA_EXIST_ALREADY("DATA_EXIST_ALREADY", "数据已经存在"),

    EXECUTE_SUCCESS("EXECUTE_SUCCESS", "执行成功"),

    WX_RED_PAKET_EXCEPTION("WX_RED_PAKET_EXCEPTION", "调用微信红包接口异常"),

    CONNECTION_TIMEOUT("CONNECTION_TIMEOUT", "连接超时"),

    VERSION_CHANGE_EXCEPTION("VERSION_CHANGE_EXCEPTION", "APP版本变更");

    private final String value;

    private final String displayName;

    private static Map<String, ResponseCodeEnums> valueMap;

    private ResponseCodeEnums(String value, String displayName) {
        this.value = value;
        this.displayName = displayName;
    }

    public ResponseCodeEnums getEnum(String value) {
        return (ResponseCodeEnums) valueMap.get(value);
    }

    public Map<String, ResponseCodeEnums> getAllValueMap() {
        return valueMap;
    }

    public String getValue() {
        return this.value;
    }

    public String getDisplayName() {
        return this.displayName;
    }

    static {
        valueMap = new HashMap<String, ResponseCodeEnums>();

        for (ResponseCodeEnums e : values())
            valueMap.put(e.value, e);
    }
}